const Koa = require('koa')
const app = new Koa()
const bodyParser = require('koa-bodyparser')// 解析post请求体
const cors = require('@koa/cors');
const useRouters = require('./router/index.js')


// 处理跨域
app.use(cors())

// 解析post请求参数
app.use(bodyParser())

// 启动路由
useRouters(app) 

app.listen(3000, () => {
  console.log('server is running at port 3000');
})